package com.donggua.aichebao.commonui.title;
import android.view.View;
import android.app.Activity;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.donggua.aichebao.commonui.R;
/**
 * Created by Administrator on 2017-08-06.
 */

public class CommonTitle {
    private Activity activity;
    private View mainView;
    private ImageView imgLeft;
    private Button btnRight;
    private TextView tvTitle;
    public CommonTitle(Activity act,View mainView){
        this.activity = act;
        this.mainView = mainView;
        imgLeft = (ImageView)mainView.findViewById(R.id.imgTitleLeft);
        btnRight = (Button)mainView.findViewById(R.id.btnTitleRight);
        tvTitle = (TextView)mainView.findViewById(R.id.tvTitleText);
    }

    public void setTitle(String text){
        tvTitle.setText(text);
    }
    public void setLeftClick(View.OnClickListener listener){
        imgLeft.setOnClickListener(listener);
    }
    public void setRightClick(View.OnClickListener listener){
        btnRight.setOnClickListener(listener);
    }
    public void setRightShow(boolean is){
        if(is){
            btnRight.setVisibility(View.VISIBLE);
        }else{
            btnRight.setVisibility(View.GONE);
        }
    }

    public void setRightTextColor(int textColor){
        btnRight.setTextColor(textColor);
    }
}
